package handler

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"starry_sky/internal/core"
	login_log_dal "starry_sky/internal/dal/login-log-dal"
	"starry_sky/internal/tools/logger"
)

func ListLoginLogPage(c *gin.Context) {
	pageSupport := login_log_dal.QueryLoginLogPage{}
	err := c.ShouldBindJSON(&pageSupport)
	if logger.HasError(err) {
		c.JSON(http.StatusInternalServerError, core.Err.WithMsg("接受参数错误"))
		return
	}
	err = login_log_dal.ListLoginLogPage(&pageSupport)
	if logger.HasError(err) {
		c.JSON(http.StatusInternalServerError, core.Err.WithMsg("列表数据查询失败"))
		return
	}
	c.JSON(http.StatusOK, core.OK.WithData(pageSupport))
}
